package ch.netcetera.planningpoker.server.model;

import javax.persistence.Id;
import javax.persistence.PrePersist;

public class DatastoreObject {
    @Id
    private Long id;
    private Integer version = 0;

    /**
     * Auto-increment version # whenever persisted
     */
    @PrePersist
    void onPersist() {
        this.setVersion(this.getVersion() + 1);
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }
}
